package com.cs.framework.core.config;

import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;

/**
 * 框架的属性配置类
 * 
 * @author hedongzhou
 * 
 */
public class PropertyConfig extends PropertyPlaceholderConfigurer {

	private Map<String, Object> propertyMap;

	/**
	 * 处理属性配置信息
	 * 
	 * @param beanFactoryToProcess
	 * @param props
	 */
	protected void processProperties(ConfigurableListableBeanFactory beanFactoryToProcess, Properties props)
			throws BeansException {
		super.processProperties(beanFactoryToProcess, props);

		propertyMap = new HashMap<String, Object>();
		for (Object keyObj : props.keySet()) {
			String key = keyObj.toString();
			String value = props.getProperty(key);
			propertyMap.put(key, value);
		}
	}

	/**
	 * 获取属性配置信息
	 * 
	 * @return
	 */
	public Map<String, Object> gePropertyMap() {
		return propertyMap;
	}

}
